$(function() {

	$.ajaxSetup({
        headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
    });
	
	$('#addmorenotice').click(function(){
    	var html="<div class='form-group can-del clearfix'><div class='col-sm-12'>"+
                "<input class='form-control' name='notice[]' placeholder='注意事项'>"
                +"</div><a class=\"delete-btn\"  onclick=\"deleteStep(this)\"><i class=\"icon-remove\"></i></a>"
                +"</div>";
    	$('#notice').append(html);
    });
	$('#addmoretools').click(function(){
    	var html="<div class='form-group can-del clearfix'><div class='col-sm-12'>"
                +"<input type='text' class='form-control' name='tools[]' placeholder='工具/原料'>"
                +"</div><a class=\"delete-btn\"  onclick=\"deleteStep(this)\"><i class=\"icon-remove\"></i></a>"
            +"</div>";
    	$('#tools-layout').append(html);
    });
    $('#addmorecontent').click(function(){
    	addMoreContent("content_step_1");
    });
    $("#addnewcontent").click(function(){
    	var i = getRandom('content_title');
    	var html = '<div id="content_step_'+i+'">'
    			   +' <div class="form-group clearfix">'
			       +'     <div class="col-sm-3"><input type="text" class="form-control" name="content_title_'+i+'" value="方法／步骤 '+i+'"></div>'
			       +' 	  <a  class="delete-btn" onclick="deleteBigStep(this)"><i class="icon-remove"></i></a>'
			       +' </div>'
	    			+'<div class="form-group can-del clearfix" >'
			        +'    <div class="col-sm-12 ">'
			        +'        <textarea class="form-control content" name="content_step_'+i+'_'+i+'" placeholder="在这里输入方法／步骤" ></textarea>'
			        +'        <div class="dropzone clearfix" id="content_step_'+i+'_'+i+'_img_box"><span class="text-left">&nbsp;&nbsp;&nbsp;请将右侧图片库的图片移入此处</span></div>'
			        +'    </div>'
			        +'    <a class="delete-btn" onclick="deleteStep(this)"><i class="icon-remove"></i></a>'
			        +'</div></div>';
    	html += '<div class="form-group clearfix">'
    			+'	<div class="col-sm-3">'
    			+'        <button type="button" class="btn btn-default btn-block" name="addmorecontent" onclick="addMoreContent(\'content_step_'+i+'\')" ><i class="glyphicon glyphicon-plus"></i>添加方法/步骤</button>'
    			+'    </div>'
    			+'</div>';
    	$("#content-layout").append(html);
    	editorInit();
    	xweidrag();
    });
});
/**
 * 修改步骤名称
 * @param own
 * @param id
 */
function contentTitleEdit(own,id)
{
	$(own).parent().hide();
	$("#"+id).show();
}
/**
 * 添加小步骤
 * @param id
 */
function addMoreContent(id){
	var i = getRandom(id);
	var hm = id+'_'+i;
	var html="<div class='form-group can-del clearfix'><div class='col-sm-12'>"
            +"<textarea class='form-control content' name='"+hm+"'></textarea>"
            +" <div class='dropzone clearfix' id='"+hm+"_img_box'><span class=\"text-left\">&nbsp;&nbsp;&nbsp;请将右侧图片库的图片移入此处</span></div>"
            +"</div><a class=\"delete-btn\"  onclick=\"deleteStep(this)\"><i class=\"icon-remove\"></i></a>"
        +"</div>";
	$('#'+id).append(html);
	editorInit();
	xweidrag();
}
/**
 * 编辑器初始化
 */
function editorInit()
{
	var editor;
	KindEditor.ready(function(K) {
		editor = K.create('.content', {	
	    	resizeType : 1,
	    	//allowPreviewEmoticons : false,
	    	afterBlur: function () { this.sync(); },
	    	allowImageUpload : true,
	    	width : "100%", 
	    	allowUpload : true,
	    	//postParams:123,
	    	//uploadJson : '/index.php?g=User&m=Upyun&a=kindedtiropic',
	    	items : ["justifyleft", "justifycenter", "justifyright","removeformat",'insertunorderedlist','insertorderedlist' ]
		});

	});
}
/**
 * 删除大的步骤
 * @param id
 */
function deleteBigStep(id){
	$(id).parent().parent().next().remove();
	$(id).parent().parent().remove();
}
/**
 * 删除小步骤
 * @param id
 */
function deleteStep(id)
{
	$(id).parent().remove();
}
function deleteImg(id)
{
	$(id).remove();
}

function getRandom(tree){
	var i = Math.floor(Math.random()*(100-10+1)+10);
	if($("input[name="+tree+"_"+i+"]").length > 0){
		i = getRandom(tree);
	}else if($("textarea[name="+tree+"_"+i+"]").length >0){
		i = getRandom(tree);
	}
	return i;
}


function getResumeChilds(url,pid,ids){
	$.ajax({
		'url':'/'+url,
		'type':'GET',
		'data':'parentid='+pid,
		success: function(data){
			if(data.status == 'success'){
				var result = data.data;
				var options ="";
				if(result.length > 0){
					$.each(result,function(k,e){
						options +='<option value="'+e.id+'">'+e.cat_name+'</option>';
					});
					if(ids == 'parent'){
						var html = '<select name="child_1" class="form-control" id="child_1" >'+
							'<option value="0">请选择分类</option>';
						html += options;
						html += '</select>';
						$("#child_1").html(html);
					}else if (ids == 'child_1'){
						var html = '<select name="child_2" class="form-control" id="child_2" onchange=\'getChilds("'+url+'",this.value,"child_1")\'>'+
							'<option value="0">请选择分类</option>';
						html += options;
						html += '</select>';
						$("#child_2").html(html);
					}else if (ids == 'child_2'){
						var html = '<select name="child_3" class="form-control" id="child_3"">'+'<option value="0">请选择分类</option>';
						html += options;
						html += '</select>';
						$("#child_3").html(html);
					}
				}
				else
				{
					if(ids == 'parent'){
						$("#child_1").html("");
						$("#child_2").html("");
						$("#child_3").html("");
					}else if (ids == 'child'){
						$("#child_2").html("");
						$("#child_3").html("");
					}else if (ids == 'subchild'){
						$("#child_3").html("");
					}
				}
			}else{

			}
		},
	});
}
/**
 *
 * @param url  默认 category
 * @param pid
 * @param ids
 */
function getChilds(url,pid,ids){
	$.ajax({
		'url':'/'+url,
		'type':'GET',
		'data':'parentid='+pid,
		success: function(data){
    		if(data.status == 'success'){
        		var result = data.data;
        		var options ="";
        		if(result.length > 0){
            		$.each(result,function(k,e){
            			options +='<option value="'+e.cat_id+'">'+e.cat_name+'</option>';
                	});
            		if(ids == 'parent'){
                		var html = '<select name="child_1" class="form-control" id="child_1" onchange=\'getChilds("'+url+'",this.value,"child_1")\'>'+
                				'<option value="0">请选择分类</option>';
						html += options;
                		html += '</select>';
        				$("#child_1").html(html);
                	}else if (ids == 'child_1'){
                		var html = '<select name="child_2" class="form-control" id="child_2" onchange=\'getChilds("'+url+'",this.value,"child_1")\'>'+
        				'<option value="0">请选择分类</option>';
                		html += options;
                		html += '</select>';
        				$("#child_2").html(html);
                    }else if (ids == 'child_2'){
                		var html = '<select name="child_3" class="form-control" id="child_3"">'+'<option value="0">请选择分类</option>';
                		html += options;
                		html += '</select>';
        				$("#child_3").html(html);
                    }
        		}
        		else
        		{
        			if(ids == 'parent'){
        				$("#child_1").html("");
        				$("#child_2").html("");
        				$("#child_3").html("");
                	}else if (ids == 'child'){
        				$("#child_2").html("");
        				$("#child_3").html("");
                    }else if (ids == 'subchild'){
        				$("#child_3").html("");
                    }
        		}
    		}else{
            		
    		}
    	},
	});
}
/**
 * 获取Bbs相关分类
 */
 function bbstype(pid,url){
    $.ajax({
        'url':'/'+url,
        'type':'GET',
        'data':'parentid='+pid,
        success: function(data){
            if(data.status == 'success'){
                var result = data.data;
                var options ="";
            }
        }

    })

 }
/**
 * 职位类型，根据父分类获取子分类
 */
function jobstype(pid,uri,id){
	var token =$('input[name=_token]').val();
	$.ajax({
		'url':'/'+uri,
		'type':'GET',
		'data':'parentid='+pid,
		error: function(request) {
			$('#'+id).html('<option value="0">没有更多分类</option>');
        },
		success: function(data){
			if(data.status == 'success'){
				var result = data.data;
				var options ="";
				var firstid;
                if(result.length > 0){
                    $.each(result,function(k,e){
						if(k==0) firstid=e.cat_id;
                        options +='<option value="'+e.cat_id+'">'+e.name+'</option>';
                    });
					if(id == 'parentId'){
						jobstype(firstid,uri,'catId');
					}
                    $('#'+id).html(options);
                }else{
    				$('#'+id).html('<option value="0">没有更多分类</option>');
    			}
			}else{
				$('#'+id).html('<option value="0">没有更多分类</option>');
			}
		},
	});
}

/**
 * 职位地区，根据父分类获取子分类
 */
function childAreas(pid,uri,id){
	$.ajax({
		'url':'/'+uri,
		'type':'GET',
		'data':'pid='+pid,
		error: function(request) {
			$('#'+id).html('<option value="0">没有更多分类</option>');
        },
		success: function(data){
			if(data.status == 'success'){
				var result = data.data;
				var options ="";
				var firstid;
                if(result.length > 0){
                    $.each(result,function(k,e){
                    	if(k==0) firstid=e.area_id;
                        options +='<option value="'+e.area_id+'">'+e.title+'</option>';
                    });
                    if(id == 'city'){
                    	childAreas(firstid,uri,'area');
                    }
                    $('#'+id).html(options);
                }else{
    				$('#'+id).html('<option value="0">没有更多分类</option>');
    			}
			}else{
				$('#'+id).html('<option value="0">没有更多分类</option>');
			}
		},
	});
}

/**
 * 行业类型
 * aram pid
 * @param ids
 */
function getCompanyTypeChilds(pid,ids,prk,uri){
    var id = prk ? prk : "id";
    var url = uri ? uri : "companytype";
    $.ajax({
        'url':'/'+url,
        'type':'GET',
        'data':'parentid='+pid,
        success: function(data){
            if(data.status == 'success'){
                var result = data.data;
                var options ="";
                if(result.length > 0){
                    $.each(result,function(k,e){
                        options +='<option value="'+e.cat_id+'">'+e.name+'</option>';
                    });
                    if(ids == 'parent'){
                        var html = '<select name="child_1" class="form-control" id="child_1" onchange="getCompanyTypeChilds(this.value,\'child_1\','+id+',\''+url+'\')">'+
                            '<option value="0">请选择分类</option>';
                        html += options;
                        html += '</select>';
                        $("#child_1").html(html);
                    }else if (ids == 'child_1'){
                        var html = '<select name="child_2" class="form-control" id="child_2" onchange="getCompanyTypeChilds(this.value,\'child_2\','+id+',\''+url+'\')">'+
                            '<option value="0">请选择分类</option>';
                        html += options;
                        html += '</select>';
                        $("#child_2").html(html);
                    }else if (ids == 'child_2'){
                        var html = '<select name="child_3" class="form-control" id="child_3"">'+'<option value="0">请选择分类</option>';
                        html += options;
                        html += '</select>';
                        $("#child_3").html(html);
                    }
                }
            }else{
                if(ids == 'parent'){
                    $("#child_1").html("");
                    $("#child_2").html("");
                    $("#child_3").html("");
                }else if (ids == 'child'){
                    $("#child_2").html("");
                    $("#child_3").html("");
                }else if (ids == 'subchild'){
                    $("#child_3").html("");
                }
            }
        },
    });
}

/**
 * 技能子级
 * aram pid
 * @param ids
 */
function getSkillChilds(pid,ids,prk,uri){
    var id = prk ? prk : "id";
    var url = uri ? uri : "subskill";
    $.ajax({
        'url':'/'+url,
        'type':'GET',
        'data':'parentid='+pid,
        success: function(data){
            if(data.status == 'success'){
                var result = data.data;
                var options ="";
                if(result.length > 0){
                    $.each(result,function(k,e){
                        options +='<option value="'+e.id+'">'+e.name+'</option>';
                    });
                    if(ids == 'parent'){
                        var html = '<select name="child_1" class="form-control" id="child_1" onchange="getSkillChilds(this.value,\'child_1\','+id+',\''+url+'\')">'+
                            '<option value="0">请选择</option>';
                        html += options;
                        html += '</select>';
                        $("#child_1").html(html);
                    }else if (ids == 'child_1'){
                        var html = '<select name="child_2" class="form-control" id="child_2" onchange="getSkillChilds(this.value,\'child_2\','+id+',\''+url+'\')">'+
                            '<option value="0">请选择</option>';
                        html += options;
                        html += '</select>';
                        $("#child_2").html(html);
                    }else if (ids == 'child_2'){
                        var html = '<select name="child_3" class="form-control" id="child_3"">'+'<option value="0">请选择</option>';
                        html += options;
                        html += '</select>';
                        $("#child_3").html(html);
                    }
                }
            }else{
                if(ids == 'parent'){
                    $("#child_1").html("");
                    $("#child_2").html("");
                    $("#child_3").html("");
                }else if (ids == 'child'){
                    $("#child_2").html("");
                    $("#child_3").html("");
                }else if (ids == 'subchild'){
                    $("#child_3").html("");
                }
            }
        },
    });
}


/**
 * 保存数据
 * @param url post地址
 * @param id form id
 */
function saveData(url,id){
	var data = $('#'+id).serialize();
	var errors="";
	$.ajax({
		'url':url,
		'type':'POST',
		'data':data,

		error: function(data) {
			var response = data.responseJSON;
			$.each(response,function(k,v){
				errors +="<div>"+v+"</div>";
			})
			BootstrapDialog.alert({title:'错误提示',message:errors});
        },
		success: function(data){
			if(data.status == 'success'){
				BootstrapDialog.alert({title:'提示',message:data.msg,callback: function(result) {
                    location.href= data.redirectUrl;
	            }});
			}else{
				BootstrapDialog.alert({title:'提示',message:data.msg});
			}

		},
	});
}


function saveTeachesData(url,id,teachesType){
	var data = $('#'+id).serialize();
	var description="";
	if(teachesType == 0){
		var descImg = new Array();
		$("#desc_img_box img").each(function(key,imgs){
			if(this.src.length > 0){
				descImg[key] = this.src ;
			}
		});
		data = data + '&descimg='+descImg;
	}
	
	var content="";
	$("input[name^=content_title_").each(function(tk,te){
		var content_content="";
		$(this).parent().parent().parent().find('textarea[name^=content_step_]').each(function(k,e){
			var content_img="";
			$("#"+this.name+"_img_box img").each(function(key,imgs){
				if(this.src.length > 0){
					content_img += this.src+"[img]";
				}else{
					content_img +="";
				}
			});
			content_content +=encodeURIComponent(e.value)+"[imgages]"+content_img+"=@-=-=-=";
		});
		content += encodeURIComponent(te.value)+"[steps]"+content_content+"[title@step]";
	})
	

	data = data +'&content='+content;
	$.ajax({
		'url':url,
		'type':'POST',
		'data':data,
		error: function(request) {
			BootstrapDialog.alert({title:'错误提示',message:'保存失败'});
        },
		success: function(data){
			if(data.status == 'success'){
				BootstrapDialog.alert({title:'提示',message:data.msg,callback: function(result) {
					location.href= data.redirectUrl;
	            }});
			}else{
				BootstrapDialog.alert({title:'提示',message:data.msg});
			}

		},
	});
}

/**
 * 拖动图片
 */
function dragsImages(){
	var eleDrags = $(".draglist"), lDrags = eleDrags.length, eleDrag = null;

	for (var i=0; i<lDrags; i+=1) {
		eleDrags[i].onselectstart = function() {
			return false;
		};
		eleDrags[i].ondragstart = function(ev) {
			ev.dataTransfer.effectAllowed = "move";
			ev.dataTransfer.setData("text", ev.target.innerHTML);
			ev.dataTransfer.setDragImage(ev.target, 0, 0);
			eleDrag = ev.target;
			return true;
		};
		eleDrags[i].ondragend = function(ev) {
			ev.dataTransfer.clearData("text");
			eleDrag = null;
			return false
		};
	}

	$("body").find(".dustbin").each(function(k,e){
		this.ondragover = function(ev) {
			ev.preventDefault();
			return true;
		};

		this.ondragenter = function(ev) {
			this.style.color = "#ffffff";
			return true;
		};
		this.ondrop = function(ev) {
			if (eleDrag) {
				this.innerHTML +="<div class='small-pic-drag'>"+ eleDrag.innerHTML+"<a class='small-pic-del' onclick='deleteImg(this.parentNode)'><i class='icon-remove'></i></a></div>";
				eleDrag.parentNode.removeChild(eleDrag);
				dragsImages();
			}
			this.style.color = "#000000";
			return false;
		};
	});
}

/**
 * 就业指南 删除
 * @param newsid
 * @param token
 */
function deleteSource(url,newsid,token){
	BootstrapDialog.confirm({
		title: '确认删除',
		message:'确定要删除吗?',
		callback:function(result){
			if(result) {
        		$.ajax({
        			'url':'/'+url+"/"+newsid,
        			'type':'delete',
        			'data':'&_token='+token,
        			success: function(data){
        				if(data.status == 'success'){
        					BootstrapDialog.alert({title:'提示',message:data.msg});
        					$("#news_"+newsid).remove();
        				}else{
        					BootstrapDialog.alert({title:'提示',message:data.msg});
        				}

        			},
        		});
			}else{
				BootstrapDialog.alert({title:'提示',message:'删除操作已取消'});
			}
		}
    });
}

/**
 *  删除
 * @param newsid
 * @param token
 */
function del_one(url,id,token,pre_id){
    pre_id = pre_id ? pre_id : 'id';
    BootstrapDialog.confirm({
        title: '确认删除',
        message:'确定要删除吗?',
        callback:function(result){
            if(result) {
                $.ajax({
                    'url':url,
                    'type':'POST',
                    'data':pre_id+"="+id+'&_token='+token,
                    success: function(data){
                        if(data.status == 'success'){
                            BootstrapDialog.alert({title:'提示',message:data.msg});
                            $("#news_"+id).remove();
                        }else{
                            BootstrapDialog.alert({title:'提示',message:data.msg});
                        }

                    },
                });
            }else{
                BootstrapDialog.alert({title:'提示',message:'删除操作已取消'});
            }
        }
    });
}
function delete_one(url,id,token){
    BootstrapDialog.confirm({
        title: '确认删除',
        message:'确定要删除吗?',
        callback:function(result){
            if(result) {
                $.ajax({
                    'url':url,
                    'type':'DELETE',
                    'data':'_token='+token,
                    success: function(data){
                        if(data.status == 'success'){
                            BootstrapDialog.alert({title:'提示',message:data.msg});
                            $("#news_"+id).remove();
                        }else{
                            BootstrapDialog.alert({title:'提示',message:data.msg});
                        }
                    },
                });
            }else{
                BootstrapDialog.alert({title:'提示',message:'删除操作已取消'});
            }
        }
    });
}

/**
 * 批量删除
 * @param url
 * @param token
 * @param pre_id
 * @param check_name
 */
function batch_del(url, token, pre_id, check_name) {
    pre_id = pre_id ? pre_id : 'id';
	var idlist = '';
	$("input[name='"+check_name+"']:checked").each(function(){
	    idlist = idlist + $(this).val() + ',';
	});
	if (idlist == '') {
	    BootstrapDialog.alert({title:'提示',message:'请选择您要删除的记录!'});
	    return false;
	}

	BootstrapDialog.confirm({
    title: '确认删除',
    message:'确定要删除吗?',
    callback:function(result){
        if(result) {
            $.ajax({
                'url':url,
                'type':'POST',
                'data':pre_id+"="+idlist+'&_token='+token,
                success: function(data){
                    if(data.status == 'success'){
                        BootstrapDialog.alert({title:'提示',message:data.msg});
                        $("input[name='"+check_name+"']:checked").each(function(){
                            $("#news_"+$(this).val()).remove();
                        });

                    }else{
                        BootstrapDialog.alert({title:'提示',message:data.msg});
                    }

                }
            });
        }else{
            BootstrapDialog.alert({title:'提示',message:'删除操作已取消'});
            }
        }
    });
}
/**
 *  删除分类
 * @param newsid
 * @param token
 */
function del_cat(url,datastr,token){
	BootstrapDialog.confirm({
	        title: '确认删除',
	    message:'确定要删除吗?',
	    callback:function(result){
	        if(result) {
	            $.ajax({
	                'url':url,
	                'type':'POST',
	                'data':datastr+'&_token='+token,
	                success: function(data){
	                    if(data.status == 'success'){
	                        BootstrapDialog.alert({title:'提示',message:data.msg});
	                        $("#news_"+id).remove();
	                    }else{
	                        BootstrapDialog.alert({title:'提示',message:data.msg});
	                    }
	
	                }
	            });
	        }else{
	            BootstrapDialog.alert({title:'提示',message:'删除操作已取消'});
	        }
	    }
	});
}



/**
 * 异步改变状态
 * @param  {[type]} url   [description]
 * @param  {[type]} id    [description]
 * @param  {[type]} val   [description]
 * @param  {[type]} token [description]
 * @return {[type]}       [description]
 */
function changeStatus(url,id,val,token)
{
    $('#grid').css('display', '');
    var datastr = 'id=' + id + '&is_disabled=' +val;
    $.ajax({
        'url':url,
        'type':'POST',
        'data':datastr+'&_token='+ token,
        success: function(data){
            if(data.status == 'success'){
                if(data.data == 1){
                    $('#news_'+id+' #disabled span').attr('class', 'glyphicon glyphicon-remove-circle red-ok');
                    $('#news_'+id+' #disabled span').attr('onclick',"changeStatus('"+url+"','"+id+"','"+data.data+"','"+token+"')");
                }
                else{
                    $('#news_'+id+' #disabled span').attr('class', 'glyphicon glyphicon-ok-circle  green-remove');
                    $('#news_'+id+' #disabled span').attr('onclick',"changeStatus('"+url+"',"+id+","+data.data+",'"+token+"')");
                }
                $('#grid').css('display', 'none');
            }

        }
    });
}

/**
 * 改变用户状态 
 * @param url 
 * @param id
 * @param val
 * @param token
 */
function changeUserStatus(url,id,val,token)
{
    $('#grid').css('display', '');
    var datastr = 'id=' + id + '&is_disabled=' +val;
    $.ajax({
        'url':url,
        'type':'POST',
        'data':datastr+'&_token='+ token,
        success: function(data){
            if(data.status == 'success'){
                if(data.data == 1){
                	$('#news_'+id+' #disabled span').attr('class', 'glyphicon glyphicon-ok-circle  green-remove');
                    $('#news_'+id+' #disabled span').attr('onclick',"changeUserStatus('"+url+"','"+id+"','"+data.data+"','"+token+"')");
                }
                else{
                	$('#news_'+id+' #disabled span').attr('class', 'glyphicon glyphicon-remove-circle red-ok');
                    $('#news_'+id+' #disabled span').attr('onclick',"changeUserStatus('"+url+"',"+id+","+data.data+",'"+token+"')");
                }
                $('#grid').css('display', 'none');
            }

        }
    });
}

//用户禁言20180208kong
function changeUserProhibited(url,id,cid,val,token)
{
	$('#grid').css('display', '');
	var datastr = 'id=' + id + '&is_disabled=' +val;
	$.ajax({
		'url':url,
		'type':'POST',
		'data':datastr+'&_token='+ token,
		success: function(data){
			if(data.status == 'success'){
				if(data.data == 1){
					$('#news_'+cid+' #disabled span').attr('class', 'glyphicon glyphicon-ok-circle  green-remove');
					$('#news_'+cid+' #disabled span').attr('onclick',"changeUserProhibited('"+url+"','"+id+"','"+cid+"','"+data.data+"','"+token+"')");
				}
				else{
					$('#news_'+cid+' #disabled span').attr('class', 'glyphicon glyphicon-remove-circle red-ok');
					$('#news_'+cid+' #disabled span').attr('onclick',"changeUserProhibited('"+url+"',"+id+",'"+cid+"',"+data.data+",'"+token+"')");
				}
				$('#grid').css('display', 'none');
			}

		}
	});
}

function changeVipStatus(url, id, val, token) {
	$('#grid').css('display', '');
	var datastr = 'id=' + id + '&is_disabled=' + val;
	$.ajax({
		'url': url,
		'type': 'POST',
		'data': datastr + '&_token=' + token,
		success: function (data) {
			if (data.status == 'success') {
				if (data.data == 1) {
					$('#news_' + id + ' #vip span').attr('class', 'glyphicon glyphicon-ok-circle  green-remove');
					$('#news_' + id + ' #vip span').attr('onclick', "changeUserStatus('" + url + "','" + id + "','" + data.data + "','" + token + "')");
				}
				else {
					$('#news_' + id + ' #vip span').attr('class', 'glyphicon glyphicon-remove-circle red-ok');
					$('#news_' + id + ' #vip span').attr('onclick', "changeUserStatus('" + url + "'," + id + "," + data.data + ",'" + token + "')");
				}
				$('#grid').css('display', 'none');
			}

		}
	});
}
function changeUserStatusShow(url, id, val, token) {
	$('#grid').css('display', '');
	var datastr = 'id=' + id + '&is_recommond=' + val;
	$.ajax({
		'url': url,
		'type': 'POST',
		'data': datastr + '&_token=' + token,
		success: function (data) {
			if (data.status == 'success') {
				if (data.data == 1) {
					$('#news_' + id + ' #disabled span').attr('class', 'glyphicon glyphicon-ok-circle  green-remove');
					$('#news_' + id + ' #disabled span').attr('onclick', "changeUserStatusShow('" + url + "','" + id + "','" + data.data + "','" + token + "')");
				}
				else {
					$('#news_' + id + ' #disabled span').attr('class', 'glyphicon glyphicon-remove-circle red-ok');
					$('#news_' + id + ' #disabled span').attr('onclick', "changeUserStatusShow('" + url + "'," + id + "," + data.data + ",'" + token + "')");
				}
				$('#grid').css('display', 'none');
			}

		}
	});
}


function changeUserStatusEmploy(url,id,val,token)
{
	$('#grid').css('display', '');
	var datastr = 'id=' + id + '&is_disabled=' +val;
	$.ajax({
		'url':url,
		'type':'POST',
		'data':datastr+'&_token='+ token,
		success: function(data){
			if(data.status == 'success'){
				if(data.data == 1){
					$('#news_'+id+' #Edisabled span').attr('class', 'glyphicon glyphicon-ok-circle  green-remove');
					$('#news_'+id+' #Edisabled span').attr('onclick',"changeUserStatusEmploy('"+url+"','"+id+"','"+data.data+"','"+token+"')");
				}
				else{
					$('#news_'+id+' #Edisabled span').attr('class', 'glyphicon glyphicon-remove-circle red-ok');
					$('#news_'+id+' #Edisabled span').attr('onclick',"changeUserStatusEmploy('"+url+"',"+id+","+data.data+",'"+token+"')");
				}
				$('#grid').css('display', 'none');
			}

		}
	});
}
/**
 * 改变用户状态 
 * @param url 
 * @param id
 * @param val
 * @param token
 */
function changeUserStatus2(url,id,val,token,divid)
{
    $('#grid').css('display', '');
    var datastr = 'id=' + id + '&is_disabled=' +val;
    $.ajax({
        'url':url,
        'type':'POST',
        'data':datastr+'&_token='+ token,
        success: function(data){
            if(data.status == 'success'){
                if(data.data == 1){
                	$('#news_'+id+' #'+divid+' span').attr('class', 'glyphicon glyphicon-ok-circle  green-remove');
                    $('#news_'+id+' #'+divid+' span').attr('onclick',"changeUserStatus('"+url+"','"+id+"','"+data.data+"','"+token+"')");
                }
                else{
                	$('#news_'+id+' #'+divid+' span').attr('class', 'glyphicon glyphicon-remove-circle red-ok');
                    $('#news_'+id+' #'+divid+' span').attr('onclick',"changeUserStatus('"+url+"',"+id+","+data.data+",'"+token+"')");
                }
                $('#grid').css('display', 'none');
            }

        }
    });
}

/**
 * 模态框 预览 图片
 * @param  {[type]} url      [控制器url]
 * @param  {[type]} where_id [查询的字段名称]
 * @param  {[type]} id       [查询的字段值]
 * @param  {[type]} token    [csrf_token]
 * @return {[type]}
 */
function view(url,where_id,id,token,title)
{
    var datastr = where_id + '=' + id;
    $.ajax({
            'url':url,
            'type':'POST',
            'data':datastr+'&_token='+ token,
            success: function(data){
                if(data.status == 'success'){
                    if (data.data != '') {
                        /*替换图片路径*/
                        var content = '<img src="'+data.data+'" alt="" class="img-responsive">';
                    } else
                    {
                        var content = '<span style="text-align:center;display:block;color:#E74C3C;">未上传图标</span>';
                    }
                    $('#myModalLabel').html(title);
                    $('#modal-body').html(content);
                    /*启用模态框*/
                    $('#myModal').modal({
                      keyboard: false
                    });
                }

            }
        });
}

/**
 * 异步查看简介
 * @param  {[type]} url      [控制器url]
 * @param  {[type]} where_id [查询的字段名称]
 * @param  {[type]} id       [查询的字段值]
 * @param  {[type]} token    [csrf_token]
 * @return {[type]}
 */
function viewInfo(url,where_id,id,token,title)
{
    var datastr = where_id + '=' + id;
    $.ajax({
            'url':url,
            'type':'POST',
            'data':datastr+'&_token='+ token,
            success: function(data){
                if(data.status == 'success'){
                    if (data.data != '') {
                        /*替换图片路径*/
                        var content = data.data;
                    }
                    $('#myModalLabel').html(title);
                    $('#modal-body').html(content);
                    /*启用模态框*/
                    $('#myModal').modal({
                      keyboard: false
                    });
                }

            }
        });
}

/**
 * 企业认证 是否通过
 * @param  {[type]} url   [description]
 * @param  {[type]} id    [description]
 * @param  {[type]} token [description]
 * @return {[type]}       [description]
 */
function approved(url,id,status,token)
{
    /*审核不通过需填写 不通过理由*/
    if (status == 2) {
        $('#company_id').attr('value', id);
        $('#status').attr('value', status);
        /*启动模态框*/
        $('#myModal1').modal({
          keyboard: false
        });
        return;
    };
    var datastr = 'company_id' + '=' + id + '&status=' + status;
    $.ajax({
            'url':url,
            'type':'POST',
            'data':datastr+'&_token='+ token,
            success: function(data){
                if(data.status == 'success' && status == 1){
                    location.reload();
                }

            }
        });
}

/**
 * 异步查看私信详情
 * @param  {[type]} url      [控制器url]
 * @param  {[type]} id       [查询的字段值]
 * @param  {[type]} token    [csrf_token]
 * @return {[type]}
 */
function viewInboxInfo(url,id,token)
{
    $('#myModal').modal({
                      keyboard: false
    });
    return false;
    var datastr = where_id + '=' + id;
    $.ajax({
            'url':url,
            'type':'POST',
            'data':datastr+'&_token='+ token,
            success: function(data){
                if(data.status == 'success'){
                    if (data.data != '') {
                        /*替换图片路径*/
                        var content = data.data;
                    }
                    $('#myModalLabel').html(title);
                    $('#modal-body').html(content);
                    /*启用模态框*/
                    $('#myModal').modal({
                      keyboard: false
                    });
                }

            }
        });
}

function delTagsDiv(id){
	$("div[tagname="+id+"]").remove();
}

/**
 * 审核文章
 */
function to_validate(url,token)
{
	var data = $("#validated").serialize()
	$.ajax({
		'url':url,
		'type':'POST',
		'data':data+'&_token='+token,
		error: function(data) {
			BootstrapDialog.alert({title:'错误提示',message:'网络连接有问题，请重试！'});
			reload(history(-1));
        },
		success: function(data){
            if(data.status == 'success'){
            	BootstrapDialog.alert({title:'审核成功',message:data.msg,callback: function(result) {
                    location.href= data.redirectUrl;
	            }});
            }else{
            	BootstrapDialog.alert({title:'错误提示',message:'网络连接有问题，请重试！'});
            }
        }
	});
}

/**
 * 就业指南文章详情模版
 * @param url
 * @param id
 */
function employModel(url,id){
	$.ajax({
		'url':"/"+url+"/"+id,
		'type':'GET',
		error: function(data) {
			BootstrapDialog.alert({title:'错误提示',message:'没有更多数据'});
        },
        success: function(data){
			if(data.status == 'success'){
				var result = data.data;
				var tags="";
				if(result.newsTag.length > 0){
					$.each(result.newsTag,function(k,e){
						tags += "<a href=\"\">"+ e+"</a>&nbsp;&nbsp;&nbsp;"
					});
				}
				var html ="<tr><td>"
									+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">文章标题:</span>"
										+"<div class=\"col-sm-5 col-xs-8\">"+result.title
										+"</div>"
									+"</div>"
								+"</tr></td>"
								+"<tr><td>"
									+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">文章分类:</span>"
										+"<div class=\"col-sm-5 col-xs-8\">"+result.topcate+result.parentcate+result.nowcate
										+"</div>"
									+"</div>"
								+"</tr></td>"
								+"<tr><td>"
									+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">文章封面:</span>"
										+"<div class=\"col-sm-5 col-xs-8\">"
											+"<div style='width:90px; height:60px;float:left;'>"
						                    	+"<img src='"+result.url+"'  height='60' width='90'/>"
						                    +"</div>"
										+"</div>"
									+"</div>"
								+"</tr></td>"
								+"<tr><td>"
									+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">文章简介:</span>"
										+"<div class=\"col-sm-5 col-xs-8\">"+result.description
										+"</div>"
									+"</div>"
								+"</tr></td>"
								+"<tr><td>"
									+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">文章简介:</span>"
										+"<div class=\"col-sm-5 col-xs-8\">"+result.content
										+"</div>"
									+"</div>"
								+"</tr></td>"
								+"<tr><td>"
									+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">文章标签:</span>"
										+"<div class=\"col-sm-5 col-xs-8\">"
											+"<strong>"
						                    	+tags
						                	+"</strong>"
										+"</div>"
									+"</div>"
								+"</tr></td>"
								+"<tr><td>"
									+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">文章来源:</span>"
										+"<div class=\"col-sm-5 col-xs-8\">"+result.from
										+"</div>"
									+"</div>"
								+"</tr></td>"
								+"<tr><td>"
									+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">发布用户:</span>"
										+"<div class=\"col-sm-5 col-xs-8\">"+result.username
										+"</div>"
									+"</div>"
								+"</tr></td>"
								+"<tr><td>"
									+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">发布时间:</span>"
										+"<div class=\"col-sm-5 col-xs-8\">"+result.created_at
										+"</div>"
									+"</div>"
								+"</tr></td>"
								+"<tr><td>"
									+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">更新时间:</span>"
										+"<div class=\"col-sm-5 col-xs-8\">"+result.updated_at
										+"</div>"
									+"</div>"
								+"</tr></td>"
								+"<tr><td>"
									+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">审核操作:</span>"
										+"<div class=\"col-sm-5 col-xs-8\">"
											+"<label class=\"radio-inline\">"
							              			+"<input type=\"radio\" name=\"is_validate\" value='0' checked> 未审核"
							            		+"</label>"
							            		+"<label class=\"radio-inline\">"
							            			+"<input type=\"radio\" name=\"is_validate\" value='1' > 审核通过"
							            		+"</label>"
							            		+"<label class=\"radio-inline\">"
						            			+"<input type=\"radio\" name=\"is_validate\" value='2' > 审核不通过"
						            		+"</label>"
											+"<input type='hidden' name='user_id' value='"+result.user_id+"'>"
											+"<input type='hidden' name='id' value='"+result.id+"'>"
										+"</div>"
									+"</div>"
								+"</tr></td>";
				$("#showinfos").html(html);
				$('#myModal').modal();
			}else{
				BootstrapDialog.alert({title:'提示',message:'没有更多数据'});
			}

		},
	});
}

/**
 * 充电加油  文章详情模版
 */
function teachesModel(url,id){
	$.ajax({
		'url':"/"+url+"/"+id,
		'type':'GET',
		error: function(data) {
			BootstrapDialog.alert({title:'错误提示',message:'没有更多数据'});
        },
        success: function(data){
			if(data.status == 'success'){
				var result = data.data;
				var html = "";
				var tags="";
				if(result.newsTag.length > 0){
					$.each(result.newsTag,function(k,e){
						tags += "<a href=\"\">"+ e+"</a>&nbsp;&nbsp;&nbsp;"
					});
				}
				html +="<tr><td>"
							+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">文章标题:</span>"
								+"<div class=\"col-sm-5 col-xs-8\">"+result.name
								+"</div>"
							+"</div>"
		     			+"</tr></td>"
		     			+"<tr><td>"
								+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">文章封面:</span>"
								+"<div class=\"col-sm-5 col-xs-8\"><img src='"+result.thumburl+"'>"
								+"</div>"
							+"</div>"
		     			+"</tr></td>"
		     			+"<tr><td>"
							+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">文章分类:</span>"
								+"<div class=\"col-sm-5 col-xs-8\">"+result.topcate+result.parentcate+result.nowcate
								+"</div>"
							+"</div>"
						+"</tr></td>"

						+ "<tr><td>"
							+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">文章简介:</span>"
		     					+"<div class=\"col-sm-5 col-xs-8\">"
		     						+result.description
		     					+"</div>"
		     				+"</div>"
						+"</tr></td>"
						+"<tr><td>"
						+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">难易成度:</span>"
						+"<div class=\"col-sm-5 col-xs-8\">";
				if(result.level == 0){
					html+="初级";
				}else if(result.level == 1){
					html+="中级";
				}else if(result.level == 2){
					html+="高级";
				}
				
					html+="</div>"
						+"</div>"
						+"</tr></td>"
						+"<tr><td>"
							+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">发布用户:</span>"
								+"<div class=\"col-sm-5 col-xs-8\">"+result.username
								+"</div>"
							+"</div>"
						+"</tr></td>"
						+"<tr><td>"
							+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">发布时间:</span>"
								+"<div class=\"col-sm-5 col-xs-8\">"+result.created_at
								+"</div>"
							+"</div>"
						+"</tr></td>"
						+"<tr><td>"
							+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">更新时间:</span>"
								+"<div class=\"col-sm-5 col-xs-8\">"+result.updated_at
								+"</div>"
							+"</div>"
						+"</tr></td>"
						+"<tr><td>"
							+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">文章标签:</span>"
								+"<div class=\"col-sm-5 col-xs-8\">"
									+"<strong>"
				                    	+tags
				                	+"</strong>"
								+"</div>"
							+"</div>"
						+"</tr></td>"
						+"<tr><td>"
							+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">其他参数:</span>"
								+"<div class=\"col-sm-5 col-xs-8\"><span>时长："
								+result.meta_value+"</span>&nbsp;&nbsp;<span>价格："+result.price+"</span>&nbsp;&nbsp;<span>浏览人数："
								+result.views_num+"</span>&nbsp;&nbsp;<span>学习人数："+result.studys_num+"</span>&nbsp;&nbsp;<span>收藏人数："
								+result.attention_num+"</span>&nbsp;&nbsp;<span>评论人数："+result.comments_num
								+"</div>"
							+"</div>"
						+"</tr></td>"
						+"<tr><td>"
							+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">审核操作:</span>"
								+"<div class=\"col-sm-5 col-xs-8\">"
									+"<label class=\"radio-inline\">"
					              			+"<input type=\"radio\" name=\"is_validate\" value='0' checked> 未审核"
					            		+"</label>"
					            		+"<label class=\"radio-inline\">"
					            			+"<input type=\"radio\" name=\"is_validate\" value='1' > 审核通过"
					            		+"</label>"
					            		+"<label class=\"radio-inline\">"
				            			+"<input type=\"radio\" name=\"is_validate\" value='2' > 审核不通过"
				            		+"</label>"
									+"<input type='hidden' name='user_id' value='"+result.user_id+"'>"
									+"<input type='hidden' name='id' value='"+result.id+"'>"
								+"</div>"
							+"</div>"
						+"</tr></td>";
				$("#showinfos").html(html);
				$('#myModal').modal();
			}else{
				BootstrapDialog.alert({title:'提示',message:'没有更多数据'});
			}

		},
	});
}

/**
 * 充电加油 企业专区  文章详情模版
 */
function teachesCompanyModel(url,id){
	$.ajax({
		'url':"/"+url+"/"+id,
		'type':'GET',
		error: function(data) {
			BootstrapDialog.alert({title:'错误提示',message:'没有更多数据'});
        },
        success: function(data){
			if(data.status == 'success'){
				var result = data.data;
				var html = "";
				var tags="";
				if(result.newsTag.length > 0){
					$.each(result.newsTag,function(k,e){
						tags += "<a href=\"\">"+ e+"</a>&nbsp;&nbsp;&nbsp;"
					});
				}
				html +="<tr><td>"
							+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">文章标题:</span>"
								+"<div class=\"col-sm-5 col-xs-8\">"+result.name
								+"</div>"
							+"</div>"
		     			+"</tr></td>"
		     			+"<tr><td>"
							+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">所属企业:</span>"
								+"<div class=\"col-sm-5 col-xs-8\">"+result.companyname
								+"</div>"
							+"</div>"
		     			+"</tr></td>"
		     			+"<tr><td>"
							+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">文章分类:</span>"
								+"<div class=\"col-sm-5 col-xs-8\">"+result.topcate+result.parentcate+result.nowcate
								+"</div>"
							+"</div>"
						+"</tr></td>";
				if(result.teaches_type == 0){
					var dimg="";
					var tools="";
					var contents = "";
					var notice ="";
					if(result.description.img.length > 0){
						$.each(result.description.img,function(k,e){
							dimg += "<div style='width:90px; height:60px;float:left;'><img src='"+e+"'  width='90'/></div>";
						});
					}
					if(result.tools.length > 0){
						$.each(result.tools,function(k,e){
							tools += "<div class='form-group'>"+e+"</div>";
						})
					}
					if(result.content.length > 0){
						$.each(result.content,function(k,e){
							contents += "<div class='form-group'>"+e.name;
							contents +="<div  class='dustbin clearfix'>";
							if(e.img.length>0)
							{
								$.each(e.img,function(key,imgs){
									contents +="<div style='width:90px; height:60px;float:left;'><img src='"+imgs+"' width='90'/></div>";
								});
							}
							contents += "</div></div>";
						});
					}
					if(result.notice.length > 0){
						$.each(result.notice,function(k,e){
							notice += "<div class='form-group' >"+e+"</div>";
						});
					}
					html +=  "<tr><td>"
				     				+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">文章简介:</span>"
				     					+"<div class=\"col-sm-5 col-xs-8\">"
				     						+"<div>"
				     							+result.description.name
				     						+"</div>"
				     						+"<div id=\"desc_img_box\" class=\"dustbin\">"
				     							+dimg
				     						+"</div>"
				     					+"</div>"
				     				+"</div>"
							+"</tr></td>"
							+"<tr><td>"
			     				+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">工具:</span>"
			     					+"<div class=\"col-sm-5 col-xs-8\">"
			     						+tools
			     					+"</div>"
			     				+"</div>"
							+"</tr></td>"
							+"<tr><td>"
			     				+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">方法／步骤:</span>"
			     					+"<div class=\"col-sm-5 col-xs-8\">"
			     						+contents
			     					+"</div>"
			     				+"</div>"
							+"</tr></td>"
							+"<tr><td>"
			     				+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">注意事项:</span>"
			     					+"<div class=\"col-sm-5 col-xs-8\">"
			     						+notice
			     					+"</div>"
			     				+"</div>"
							+"</tr></td>";
				}else if(result.teaches_type == 1){
					var video_name ="";
					var video_url = "";
					if(result.teachesVideo.length > 0)
					{
						video_name =result.teachesVideo.video_name;
						video_url = result.teachesVideo.video_url;
					}
					html += "<tr><td>"
								+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">文章简介:</span>"
			     					+"<div class=\"col-sm-5 col-xs-8\">"
			     						+result.description
			     					+"</div>"
			     				+"</div>"
							+"</tr></td>"
							+"<tr><td>"
							+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">视频:</span>"
		     					+"<div class=\"col-sm-5 col-xs-8\">"
		     						+"<video src='"+url+"' autoplay controls='controls' width='200' >"+
		     					+"</div>"
		     				+"</div>"
						+"</tr></td>";
				}else if(result.teaches_type == 2){
					var name ="";
					var url = "";
					var pdf ="";
					var swf="";
					if(result.teachesOffice.length > 0)
					{
						name =result.teachesOffice.name;
						url = result.teachesOffice.url;
						pdf = result.teachesOffice.pdf_url;
						swf = result.teachesOffice.swf_url;
					}
					html += "<tr><td>"
						+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">文章简介:</span>"
	     					+"<div class=\"col-sm-5 col-xs-8\">"
	     						+result.description
	     					+"</div>"
	     				+"</div>"
					+"</tr></td>"
					+"<tr><td>"
					+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">OFFICE:</span>"
     					+"<div class=\"col-sm-5 col-xs-8\">"
     						+url
     					+"</div>"
     				+"</div>"
     				+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">PDF:</span>"
	 					+"<div class=\"col-sm-5 col-xs-8\">"
	 						+pdf
	 					+"</div>"
	 				+"</div>"
	 				+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">SWF:</span>"
	 					+"<div class=\"col-sm-5 col-xs-8\">"
	 						+swf
	 					+"</div>"
	 				+"</div>"
				+"</tr></td>";
				}
				
				html += "<tr><td>"
							+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">发布用户:</span>"
								+"<div class=\"col-sm-5 col-xs-8\">"+result.username
								+"</div>"
							+"</div>"
						+"</tr></td>"
						+"<tr><td>"
							+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">发布时间:</span>"
								+"<div class=\"col-sm-5 col-xs-8\">"+result.created_at
								+"</div>"
							+"</div>"
						+"</tr></td>"
						+"<tr><td>"
							+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">更新时间:</span>"
								+"<div class=\"col-sm-5 col-xs-8\">"+result.updated_at
								+"</div>"
							+"</div>"
						+"</tr></td>"
						+"<tr><td>"
							+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">其他参数:</span>"
								+"<div class=\"col-sm-5 col-xs-8\"><span>价格："
								+result.price+"</span>&nbsp;&nbsp;<span>浏览人数："
								+result.views_num+"</span>&nbsp;&nbsp;<span>学习人数："+result.studys_num+"</span>&nbsp;&nbsp;<span>收藏人数："
								+result.attention_num+"</span>&nbsp;&nbsp;<span>评论人数："+result.comments_num
								+"</div>"
							+"</div>"
						+"</tr></td>"
						+"<tr><td>"
							+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">审核操作:</span>"
								+"<div class=\"col-sm-5 col-xs-8\">"
									+"<label class=\"radio-inline\">"
					              			+"<input type=\"radio\" name=\"is_validate\" value='0' checked> 未审核"
					            		+"</label>"
					            		+"<label class=\"radio-inline\">"
					            			+"<input type=\"radio\" name=\"is_validate\" value='1' > 审核通过"
					            		+"</label>"
					            		+"<label class=\"radio-inline\">"
				            			+"<input type=\"radio\" name=\"is_validate\" value='2' > 审核不通过"
				            		+"</label>"
									+"<input type='hidden' name='user_id' value='"+result.user_id+"'>"
									+"<input type='hidden' name='id' value='"+result.id+"'>"
								+"</div>"
							+"</div>"
						+"</tr></td>";
				$("#showinfos").html(html);
				$('#myModal').modal();
			}else{
				BootstrapDialog.alert({title:'提示',message:'没有更多数据'});
			}

		},
	});
}

/**
 * 
 * @param url
 * @param id
 */
function companyModel(url,id){
	$.ajax({
		'url':"/"+url+"/"+id,
		'type':'GET',
		error: function(data) {
			BootstrapDialog.alert({title:'错误提示',message:'没有更多数据'});
        },
        success: function(data){
			if(data.status == 'success'){
				var result = data.data;
				var tags="";
				if(result.newsTag.length > 0){
					$.each(result.newsTag,function(k,e){
						tags += "<a href=\"\">"+ e+"</a>&nbsp;&nbsp;&nbsp;"
					});
				}
				var html ="<tr><td>"
									+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">企业名称:</span>"
										+"<div class=\"col-sm-5 col-xs-8\">"+result.name
										+"</div>"
									+"</div>"
								+"</tr></td>"
								+"<tr><td>"
									+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">行业分类:</span>"
										+"<div class=\"col-sm-5 col-xs-8\">"+
										+"</div>"
									+"</div>"
								+"</tr></td>"
								+"<tr><td>"
									+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">企业logo:</span>"
										+"<div class=\"col-sm-5 col-xs-8\">"
						                    	+"<img src='http://cimo.oss-cn-hangzhou.aliyuncs.com"+result.logo+"'  height='80' width='80'/>"
										+"</div>"
									+"</div>"
								+"</tr></td>"
								+"<tr><td>"
									+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">企业签名:</span>"
										+"<div class=\"col-sm-5 col-xs-8\">"+result.signature
										+"</div>"
									+"</div>"
								+"</tr></td>"
								+"<tr><td>"
									+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">企业简介:</span>"
										+"<div class=\"col-sm-5 col-xs-8\">"+result.intro
										+"</div>"
									+"</div>"
								+"</tr></td>"
								+"<tr><td>"
									+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">企业标签:</span>"
										+"<div class=\"col-sm-5 col-xs-8\">"
											+"<strong>"
						                    	+tags
						                	+"</strong>"
										+"</div>"
									+"</div>"
								+"</tr></td>"
								+"<tr><td>"
									+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">企业邮箱:</span>"
										+"<div class=\"col-sm-5 col-xs-8\">"+result.email
										+"</div>"
									+"</div>"
								+"</tr></td>"
								+"<tr><td>"
									+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">企业电话:</span>"
										+"<div class=\"col-sm-5 col-xs-8\">"+result.phone
										+"</div>"
									+"</div>"
								+"</tr></td>"
								+"<tr><td>"
									+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">企业规模:</span>"
										+"<div class=\"col-sm-5 col-xs-8\">"+result.scalename
										+"</div>"
									+"</div>"
								+"</tr></td>"
								+"<tr><td>"
									+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">申请时间:</span>"
										+"<div class=\"col-sm-5 col-xs-8\">"+result.created_at
										+"</div>"
									+"</div>"
								+"</tr></td>"
								+"<tr><td>"
									+"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">审核操作:</span>"
										+"<div class=\"col-sm-5 col-xs-8\">"
											+"<label class=\"radio-inline\">"
							              			+"<input type=\"radio\" name=\"is_validate\" value='0' checked> 未审核"
							            		+"</label>"
							            		+"<label class=\"radio-inline\">"
							            			+"<input type=\"radio\" name=\"is_validate\" value='1' > 审核通过"
							            		+"</label>"
							            		+"<label class=\"radio-inline\">"
						            			+"<input type=\"radio\" name=\"is_validate\" value='2' > 审核不通过"
						            		+"</label>"
											+"<input type='hidden' name='user_id' value='"+result.user_id+"'>"
											+"<input type='hidden' name='id' value='"+result.id+"'>"
										+"</div>"
									+"</div>"
								+"</tr></td>";
				$("#showinfos").html(html);
				$('#myModal').modal();
			}else{
				BootstrapDialog.alert({title:'提示',message:'没有更多数据'});
			}

		},
	});
}



/**
 *
 * @param url
 * @param id
 */
function companyJobModel(url,id){
	$.ajax({
		'url':"/"+url+"/"+id,
		'type':'GET',
		error: function(data) {
			BootstrapDialog.alert({title:'错误提示',message:'没有更多数据'});
		},
		success: function(data){
			if(data.status == 'success'){
				var result = data.data;
				var html ="<tr><td>"
					           +"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">职位名称:</span>"
					             +"<div class=\"col-sm-5 col-xs-8\">"+result.title
					             +"</div>"
					           +"</div>"
					       +"</tr></td>"
					       +"<tr><td>"
					           +"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">公司名称:</span>"
					             +"<div class=\"col-sm-5 col-xs-8\">"+result.companyname
					             +"</div>"
					           +"</div>"
					       +"</tr></td>"
					       +"<tr><td>"
					           +"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">职位类型:</span>"
					             +"<div class=\"col-sm-5 col-xs-8\">"+result.ptypename+result.typename
					             +"</div>"
					           +"</div>"
					       +"</tr></td>"
					       +"<tr><td>"
					           +"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">任职地区:</span>"
					             +"<div class=\"col-sm-5 col-xs-8\">"+result.cityname+result.areaname
					             +"</div>"
					           +"</div>"
					       +"</tr></td>"
					       +"<tr><td>"
					           +"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">职位介绍:</span>"
					             +"<div class=\"col-sm-5 col-xs-8\">"+result.intro
					             +"</div>"
					           +"</div>"
					       +"</tr></td>"
					       +"<tr><td>"
					           +"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">职位描述:</span>"
					             +"<div class=\"col-sm-5 col-xs-8\">"+result.description
					             +"</div>"
					           +"</div>"
					       +"</tr></td>"
					       +"<tr><td>"
					           +"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">招聘人数:</span>"
					             +"<div class=\"col-sm-5 col-xs-8\">"+result.recruitment
					             +"</div>"
					           +"</div>"
					       +"</tr></td>"
					       +"<tr><td>"
					           +"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">薪资要求:</span>"
					             +"<div class=\"col-sm-5 col-xs-8\">"+result.salary_name
					             +"</div>"
					           +"</div>"
					       +"</tr></td>"
					       +"<tr><td>"
					           +"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">学历要求:</span>"
					             +"<div class=\"col-sm-5 col-xs-8\">"+result.degree_name
					             +"</div>"
					           +"</div>"
					       +"</tr></td>"
					       +"<tr><td>"
					           +"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">工作年限:</span>"
					             +"<div class=\"col-sm-5 col-xs-8\">"+result.gznx_name
					             +"</div>"
					           +"</div>"
					       +"</tr></td>"
					       +"<tr><td>"
					          +"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">工作性质:</span>"
					            +"<div class=\"col-sm-5 col-xs-8\">"+result.gzxz_name
					            +"</div>"
					          +"</div>"
					       +"</tr></td>"
					       +"<tr><td>"
					          +"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">是否考试:</span>"
					            +"<div class=\"col-sm-5 col-xs-8\">"+result.test
					            +"</div>"
					          +"</div>"
					       +"</tr></td>"
					       +"<tr><td>"
					           +"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">申请时间:</span>"
					              +"<div class=\"col-sm-5 col-xs-8\">"+result.created_at
					              +"</div>"
					           +"</div>"
					       +"</tr></td>"
					       +"<tr><td>"
					           +"<div class=\"form-group\"><span class=\"col-sm-4 col-xs-3 control-label\">审核操作:</span>"
					             +"<div class=\"col-sm-5 col-xs-8\">"
					                +"<label class=\"radio-inline\">"
					                    +"<input type=\"radio\" name=\"status\" value='0' checked> 未审核"
					                +"</label>"
					                +"<label class=\"radio-inline\">"
					                    +"<input type=\"radio\" name=\"status\" value='1' > 审核通过"
					                +"</label>"
					                +"<label class=\"radio-inline\">"
					                    +"<input type=\"radio\" name=\"status\" value='2' > 审核不通过"
					                +"</label>"
					                +"<label class=\"radio-inline\">"
					                    +"<input type=\"radio\" name=\"status\" value='3' > 关闭"
					                +"</label>"
					                +"<input type='hidden' name='user_id' value='"+result.user_id+"'>"
					                +"<input type='hidden' name='jobs_id' value='"+result.jobs_id+"'>"
					             +"</div>"
					           +"</div>"
					       +"</tr></td>";
				$("#showinfos").html(html);
				$('#myModal').modal();
			}else{
				BootstrapDialog.alert({title:'提示',message:'没有更多数据'});
			}

		},
	});
}


/*=========================处理当前时间的前几天日期 开始====================================*/
 function addByTransDate(dateParameter, num) {
    var translateDate = "", dateString = "", monthString = "", dayString = "";
    translateDate = dateParameter.replace("-", "/").replace("-", "/");
    var newDate = new Date(translateDate);
    newDate = newDate.valueOf();
    newDate = newDate + num * 24 * 60 * 60 * 1000;
    newDate = new Date(newDate);
    //如果月份长度少于2，则前加 0 补位
    if ((newDate.getMonth() + 1).toString().length == 1) {
      monthString = 0 + "" + (newDate.getMonth() + 1).toString();
    } else {
      monthString = (newDate.getMonth() + 1).toString();
    }
    //如果天数长度少于2，则前加 0 补位
    if (newDate.getDate().toString().length == 1) {
      dayString = 0 + "" + newDate.getDate().toString();
    } else {
      dayString = newDate.getDate().toString();
    }
    dateString = newDate.getFullYear() + "-" + monthString + "-" + dayString;
    return dateString;
}

function reduceByTransDate(dateParameter, num) {
  var translateDate                              = "", dateString = "", monthString = "", dayString = "";
  translateDate                                  = dateParameter.replace("-", "/").replace("-", "/");
  var newDate                                    = new Date(translateDate);
  newDate                                        = newDate.valueOf();
  newDate                                        = newDate - num * 24 * 60 * 60 * 1000;
  newDate                                        = new Date(newDate);
  //如果月份长度少于2，则前加 0 补位
  if ((newDate.getMonth() + 1).toString().length == 1) {
    monthString                                    = 0 + "" + (newDate.getMonth() + 1).toString();
  } else {
    monthString                                    = (newDate.getMonth() + 1).toString();
  }
  //如果天数长度少于2，则前加 0 补位
  if (newDate.getDate().toString().length        == 1) {
    dayString                                      = 0 + "" + newDate.getDate().toString();
  } else {
    dayString                                      = newDate.getDate().toString();
  }
  dateString                                     = newDate.getFullYear() + "-" + monthString + "-" + dayString;
  return dateString;
}

//得到日期  主方法
    function showTime(pdVal) {
      var trans_day  = "";
      var cur_date   = new Date();
      var cur_year   = cur_date.getFullYear();
      var cur_month  = cur_date.getMonth() + 1;
      var real_date  = cur_date.getDate();
      cur_month      = cur_month > 9 ? cur_month : ("0" + cur_month);
      real_date      = real_date > 9 ? real_date : ("0" + real_date);
      eT             = cur_year + "-" + cur_month + "-" + real_date;
      if (pdVal      == 1) {
        trans_day      = addByTransDate(eT, 1);
      }
      else if (pdVal == -1) {
        trans_day      = reduceByTransDate(eT, 1);
      }
      else {
        trans_day      = eT;
      }
      //处理
      return trans_day;
    }
/*=========================处理当前时间的前几天日期 结束====================================*/

function getArtical(val,token)
{
	$.ajax({
		'url':'/articals',
		'type':'POST',
		'data':"modules="+val+"&_token="+token,
		error: function(request) {
			BootstrapDialog.alert({title:'错误提示',message:'获取数据失败'});
        },
		success: function(data){
			var html="";
			if(data.status == 'success'){
				$.each(data.data,function(k,v){
					if(val == 'enterprise')
					{
						html+="<option value='"+v.id+"'>"+v.name+"</option>"
					}
					else
					{
						html+="<option value='"+v.id+"'>"+v.title+"</option>"
					}
				});
				$("#artical").html(html);
			}
		},
	});
}

function checkArtical(val)
{
	var module = $("#modules").val();
	$("#other_link").val($("#other_link").val()+module+":"+val+",");
}
/**
 * 获取相关试题
 */
function getQuestions(value,url,id){
	$.ajax({
		'url':url+value,
		'type':'GET',
		error: function(request) {
			BootstrapDialog.alert({title:'错误提示',message:'获取数据失败'});
        },
        success: function(data){
			var html="";
			if(data.status == 'success'){
				$.each(data.data,function(k,v){
					html+="<label><input type='checkbox' name='question_id[]' value='"+v.id+"'>&nbsp;&nbsp;&nbsp;"+v.title+"</label>";
				});
				$("#"+id).html(html);
				icheckInput();
			}else{
				$("#"+id).html(data.msg);
			}
		},
	});
}
/**
 * 根据企业获取相关试卷
 */
function getExaminations(value,url,id)
{
	$.ajax({
		'url':url+value,
		'type':'GET',
		error: function(request) {
			BootstrapDialog.alert({title:'错误提示',message:'获取数据失败'});
        },
        success: function(data){
			var html="";
			if(data.status == 'success'){
				$.each(data.data,function(k,v){
					html+="<option value='"+v.id+"'>"+v.name+"</option>";
				});
				$("#"+id).html(html);
			}else{
				html = "<option value='0'>"+data.msg+"</option>";
				$("#"+id).html(html);
			}
		},
	});
}
/**
 * 加载icheck
 */
function icheckInput(){
	$('input[type="checkbox"]').iCheck({
        checkboxClass: 'icheckbox_flat-blue',
        radioClass: 'iradio_flat-blue',
        increaseArea: '-10' // optional
    });
}

/**
 * 图片移动
 */
function xweidrag()
{
	$('.drag').draggable({ 
		  appendTo: 'body',
		  helper: 'clone'
	});
	$('.dropzone').droppable({
	  activeClass: 'active',
	  hoverClass: 'hover',
	  accept: ":not(.ui-sortable-helper)", // Reject clones generated by sortable
	  drop: function (e, ui) {
	    var $el = $('<div class="drop-item"><img src="' + ui.draggable[0].childNodes[0].src + '" width="100"></div>');
	    $el.append($('<a class="small-pic-del"><i class="icon-remove"></i></a>').click(function () { $(this).parent().detach(); }));
	    ui.draggable.remove();
	    $(this).find("span").remove();
	    $(this).append($el);
	  }
	}).sortable({
	  items: '.drop-item',
	  sort: function() {
	    // gets added unintentionally by droppable interacting with sortable
	    // using connectWithSortable fixes this, but doesn't allow you to customize active/hoverClass options
	    $( this ).removeClass( "active" );
	  }
	});
}
/**
 * 显示全部评论
 */
function showComment(content){
    layer.open({
        title: '评论内容',
        content: content
    });
}

/**
 * 查看用户简历
 */
function viewuserResume(url)
{
	$.ajax({
		'url':url,
		'type':'GET',
		error:function(data){
			layer.open({title:'系统提示',content:'网络异常！'});
		},
		success:function(data){
			if(data.status=='success'){
				var result = data.data;
				var html='';
				var experiences='';
				var educationals= '';
				var projects='';
				$.each(result.experiences,function(key,exp){
					experiences +=  ' <div class="resume-content mr_w840" id="experience">'
						+'     <div class="list_show" id="list_show_experience" >'
						+'         <div class="mr_jobe_list">'
						+'             <div class="clearfix">'
						+'                 <div class="mr_content_l">'
						+' 					<div class="l2">'
						+' 						<a class="projectTitle nourl">'+exp.company_name+'</a>'
						+' 						<p>'+exp.job+'</p>'
						+' 					</div>'
						+' 				</div>'
						+' 				<div class="mr_content_r">'
						+' 					<span>'+exp.start_at+' - '+exp.end_at+'</span>'
						+' 				</div>'
						+'             </div>'
						+'             <div class="mr_content_m">'
						+				exp.content
						+' 			</div>'
						+'         </div>'
						+'     </div>'
						+' </div>';
				});
				$.each(result.educationals,function(ke,edu){
					educationals +=' <div class="resume-content mr_w840">'
						+'     <div class="list_show" id="list_show_educational" >'
						+'         <div class="mr_jobe_list">'
						+'             <div class="clearfix">'
						+'                 <div class="mr_content_l">'
						+' 					<div class="l2">'
						+' 						<a class="projectTitle nourl">'+edu.school+'</a>'
						+' 						<p>'+result.degrees[edu.degree]+'· '+edu.major+'</p>'
						+' 					</div>'
						+' 				</div>'
						+' 				<div class="mr_content_r">'
						+' 					<span>'+edu.graduated_at+'年毕业</span>'
						+'  				</div>'
						+'             </div>'
						+'         </div>'
						+'     </div>'
						+' </div>';
				});
				$.each(result.projects,function(k,prj){
					projects += '<div class="mr_jobe_list">'
						+'              <div class="clearfix">'
						+'                 <div class="mr_content_l">'
						+' 					<div class="l2">'
						+' 						<a class="projectTitle nourl">'+prj.name+'</a>'
						+' 						<p>'+prj.duty+'</p>'
						+' 					</div>'
						+' 				</div>'
						+' 				<div class="mr_content_r">'
						+' 					<span>'+prj.start_at+' - '+prj.end_at+'</span>'
						+' 				</div>'
						+'             </div>'
						+' 			<div class="mr_content_m">'
						+				prj.intro
						+' 			</div>'
						+'         </div>';
				})
				var signature = '';
				if(result.signature != null && result.signature != undefined  )
					signature = result.signature;
				html='<div class="resume-header">'
					+'   	<img src="/images/front/member/bg.jpg">'
					+'       <div class="resume-header-logo">'
					+'           <img src="'+result.logo+'">'
					+'     </div>'
					+' </div>'
					+' <div class="resume-userinfo">'
					+'     <div class="resume-userinfo-title mr_w840 mb15">'
					+'         <span  class="userinfo-show user-name">'+result.name+'</span>'
					+'     </div>'
					+'     <div class="resume-userinfo-center mr_w840 mb15">'
					+'         <span  class="userinfo-show">'+signature+'</span>'
					+'     </div>'
					+'     <div class="resume-userinfo-center mr_w840">'
					+'          <div class="mb10">'
					+'             <span  class="userinfo-show">'
					+'                 <img src="/images/front/member/data.jpg">'
					+'                 <span class="ml10">'
					+'                     '+result.sex+'&nbsp;&nbsp;'
					+'                     '+result.age+'岁&nbsp;&nbsp;'
					+'                     '+result.degrees[result.highest_degree]+'&nbsp;&nbsp;'
					+                     	result.gznx+'年'
					+'                 </span>'
					+'             </span>'
					+'         </div>'
					+'         <div class="mb10">'
					+'             <span  class="userinfo-show">'
					+'                 <img src="/images/front/member/call.jpg">'
					+'                 <span class="ml10">'
					+'                     '+result.phone+'&nbsp;&nbsp;&nbsp;&nbsp;'
					+'                     <i class="icon-envelope"></i>&nbsp;'+result.email
					+'                 </span>'
					+'             </span>'
					+'         </div>'
					+'     </div>'
					+' </div>'
					+' <div class="mr_moudle_head clearfix mr_w840">'
					+' 	<div class="fl">'
					+' 		<div class="mr_title">'
					+' 			<span class="mr_title_l"></span><span class="mr_title_c">工作经历</span><span class="mr_title_r" style="width: 342px"></span>'
					+' 		</div>'
					+' 	</div>'
					+' </div>'
					+	experiences
					+' <div class="mr_moudle_head clearfix mr_w840">'
					+' 	<div class="fl">'
					+' 		<div class="mr_title">'
					+' 			<span class="mr_title_l"></span><span class="mr_title_c">教育经历</span><span class="mr_title_r" style="width: 342px"></span>'
					+' 		</div>'
					+' 	</div>'
					+' </div>'
					+ educationals
					+' <div class="mr_moudle_head clearfix mr_w840">'
					+' 	<div class="fl">'
					+' 		<div class="mr_title">'
					+' 			<span class="mr_title_l"></span><span class="mr_title_c">项目经验</span><span class="mr_title_r" style="width: 342px"></span>'
					+' 		</div>'
					+' 	</div>'
					+' </div>'
					+' <div class="resume-content mr_w840">'
					+'     <div class="list_show" id="list_show_projects" >'
					+		projects
					+'     </div>'
					+' </div>'
					+' <div class="mr_moudle_head clearfix mr_w840">'
					+' 	<div class="fl">'
					+' 		<div class="mr_title">'
					+' 			<span class="mr_title_l"></span><span class="mr_title_c">自我描述</span><span class="mr_title_r" style="width: 342px"></span>'
					+' 		</div>'
					+' 	</div>'
					+' </div>'
					+' <div class="resume-content mr_w840">'
					+'    <div class="self_intro clearfix" id="intro_show">'
					+'     	<div class="fl self-intro-left">'
					+'     	   <img src="'+result.logo+'" width="80" height="80">'
					+'     	</div>	';
				if(result.intro != undefined && result.intro != null ){
					html+= ' <div class="fl self-intro-right" id="other_insert">'
						+			result.intro
						+'         </div>';
				}
				html+='     </div>'
					+' </div>'
					+' <div class="mr_moudle_head clearfix mr_w840">'
					+' 	<div class="fl">'
					+' 		<div class="mr_title">'
					+' 			<span class="mr_title_l"></span><span class="mr_title_c">期望工作</span><span class="mr_title_r" style="width: 342px"></span>'
					+' 		</div>'
					+' 	</div>'
					+' </div>';
				if(result.needs != undefined && result.needs != null ){
					html+=' <div class="resume-content mr_w840">'
						+'     <div class="list_show" >'
						+'         <div class="mr_jobe_list clearfix" id="expect_show">'
						+'         	<ul>'
						+'         	   <li><i class="icon-user-md"></i>&nbsp;&nbsp;'+result.needs.name+'</li>'
						+'         	   <li><i class="icon-time"></i>&nbsp;&nbsp;'+result.gzxzs[result.needs.job_type]+'</li>'
						+'         	   <li><i class="icon-map-marker"></i>&nbsp;&nbsp;'+result.needs.cityname+'</li>'
						+'         	   <li><i class="icon-money"></i>&nbsp;&nbsp;'+result.salarys[result.needs.expect_wages]+'</li>'
						+'         	</ul>'
						+'     	</div>'
						+' 	</div>'
						+'</div>';
				}
				if(result.resume_status != undefined && result.resume_status != null ){
					html+= '<div class="mr_self_state company-center-form">'
						+'	<div class="form_wrap">'
						+'    <input id="resume_status" name="resume_status" type="button" style="height: 44px;" class="form-control"  value="'+result.resume_status+'">'
						+'	</div>					'
						+'</div>';
				}
				$('#myModalLabel').html(result.name+'的简历');
				$('#resumebody').html(html);
				$('#myModal').modal();
			}else{
				layer.open({title:'系统提示',content:data.msg});
			}
		}
	});
}
